$(function(){
	//获取日期
	function getDate(){
		var currentDate = new Date();
		return myDate = {
			y : currentDate.getFullYear(),
			m : currentDate.getMonth() + 1,
			d : currentDate.getDate()
		}
	}
	//生日select年份填充
	function setBirthDate(){
		var beforeY = getDate().y;
		var stry = '';
		for(var i = 0; i <= 90; i++){
			stry += '<option value=' + (beforeY - i) + '>' + (beforeY - i) + '</option>\n';
		}
		$('#birthyear').append(stry);

		var strm = '';
		for(var j = 1; j <= 12; j++){
			strm += '<option value=' + j + '>' + j + '月</option>\n';
		}
		$('#birthmonth').append(strm);

		var strd = '';
		for(var k = 1; k <= 31; k++){
			strd += '<option value=' + k + '>' + k + '日</option>\n';
		}
		$('#birthday').append(strd);
	}
	setBirthDate();

	//省市区联动
	function changecity(provinceid, cityid, areaid){
		//alert($.citylist);
		var list = window.citylist;
		var strp = '';
		var strc = '';
		var stra = '';
		for(var i=0; i<list.length; i++){
			strp += '<option value=' + list[i]['name'] + '>' + list[i]['name'] + '</option>\n';
			if( list[i]['name'] == '北京' ){
				for(var j=0; j<list[i]['city'].length; j++){
					strc += '<option value=' + list[i]['city'][j]['name'] + '>' + list[i]['city'][j]['name'] + '</option>\n';
					if( list[i]['city'][j]['name'] == '北京' ){
						for( var k=0; k<list[i]['city'][j]['area'].length; k++ ){
							stra += '<option value=' + list[i]['city'][j]['area'][k] + '>' + list[i]['city'][j]['area'][k] + '</option>\n';
						}
					}
				}
			}
		}
		$('#'+areaid).empty().append(stra);
		$('#'+cityid).empty().append(strc);
		$('#'+provinceid).append(strp);

		$('#'+provinceid).change(function(){
			var province = $(this).val();
			var strc = '';
			var stra = '';
			for(var i=0; i<list.length; i++){
				if( list[i]['name'] == province ){
					for(var j=0; j<list[i]['city'].length; j++){
						strc += '<option value=' + list[i]['city'][j]['name'] + '>' + list[i]['city'][j]['name'] + '</option>\n';
						if( j == 0 ){
							for( var k=0; k<list[i]['city'][j]['area'].length; k++ ){
								stra += '<option value=' + list[i]['city'][j]['area'][k] + '>' + list[i]['city'][j]['area'][k] + '</option>\n';
							}
						}
					}
					$('#'+areaid).empty().append(stra);
					$('#'+cityid).empty().append(strc);
					return;
				}
			}
		});
		$('#'+cityid).change(function(){
			var province = $('#'+provinceid).val();
			var city = $(this).val();
			var stra = '';
			for(var i=0; i<list.length; i++){
				if( list[i]['name'] == province ){
					for(var j=0; j<list[i]['city'].length; j++){
						if( list[i]['city'][j]['name'] == city ){
							for( var k=0; k<list[i]['city'][j]['area'].length; k++ ){
								stra += '<option value=' + list[i]['city'][j]['area'][k] + '>' + list[i]['city'][j]['area'][k] + '</option>\n';
							}
							$('#'+areaid).empty().append(stra);
							return;
						}
					}
				}
			}
		})
	}
	changecity('birthprovince', 'birthcity', 'birtharea');
	changecity('nowprovince', 'nowcity', 'nowarea');
	//var cityJson = $.parseJSON(citylist);
	//console.log(citylist)
	
	
	//搜索框鼠标点击文字消失
	$('.kefu_form input.tel')
		.focus(function(){if($(this).val()=='输入号码，立即给您回电')$(this).val('');})
		.blur(function(){if($(this).val()=='' || $(this).val() == '输入号码，立即给您回电')	$(this).val('输入号码，立即给您回电');});
	
	

})
$(document).ready(function() {
	$('.floatDqq li:last').css('border-bottom',0)
})

